﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="fhdb" content="true">
    <title>当前佣金</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/mycommission.css">
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
</head>
<body>
    <div class="phoneError">
    </div>
    <div class="backBox" onClick="javascript:history.back(-1);">
        <span class="glyphicon glyphicon-chevron-left"></span>
    </div>
    <div class="topTitle">
        当前佣金
    </div>
    <div class="bd_banner">
        <div>
            <div>总佣金(元)</div>
            <div id="yjall"></div>
        </div>
        <div>
            <div>当前佣金(元)</div>
            <div id="dqyj"></div>
        </div>
        <div>
            <div>已提佣金(元)</div>
            <div id="yjyt"></div>
        </div>
    </div>
    <div class="yy_all">
        <div class="yy_title withdrawal">
            <img src="images/tixian.png" />
            <span>提现</span>
            <span style="float:right;">></span>
        </div>
        <div class="yy_title withdrawalList">
            <img src="images/jilu.png" />
            <span>提现记录</span>
            <span style="float:right;">></span>
        </div>
        <div class="yy_title commission">
            <img src="images/jilu.png" />
            <span>佣金明细</span>
            <span style="float:right;">></span>
        </div>
    </div>
    <!-- 提现 -->
    <div class="covers">
    </div>
    <div class="bigWithdrawalBox">
        <div>
            <span>余额：￥</span> <span class="price"></span>
        </div>
        <div>
            <span>*提现金额：</span>
            <input type="text" placeholder="请输入提现金额" onkeyup="clearNoNum(this)" id="txprice">
        </div>
        <p>
            1、提现需满100元<br />
            2、提现扣除10%手续费<br />
            3、提现后3-5个工作日到账<br />
            4、请务必将支付授权信息填写正确
        </p>
        <div>
            <button class="cancel-withdrawal">
                取消
            </button>
            <button class="confirm-withdrawal">
                确认
            </button>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    $(function () {
        $.ajax({
            type: "post",
            url: "../../BaseRefWeb.aspx?stype=ISpMemberFun&method=GetMyDqYj&type=sp",
            success: function (result) {
                if (result != "") {
                    var data = JSON.parse(result);
                    if (data.msg == "_timeout") {
                        window.location.href = "../UserLogin/Login.html";
                    }
                    else {
                        $("#yjall").text(data.YJALL);
                        $("#yjyt").text(data.YJYT);
                        $("#dqyj").text(data.YJDQ);
                    }
                }
            }
        });
        // 提现列表
        $(".withdrawalList").click(function () {
            location.href = 'withdrawalList.html';
        })
        // 佣金明细
        $(".commission").click(function () {
            location.href = 'commission.html';
        })
        // 提现
        $(".withdrawal").click(function () {
            $.ajax({
                type: "post",
                url: "../../BaseRefWeb.aspx?stype=ISpMemberFun&method=GetZfYuE&type=sp",
                success: function (result) {
                    if (result != "") {
                        var data = JSON.parse(result);
                        if (data.msg == "_timeout") {
                            window.location.href = "../UserLogin/Login.html";
                        }
                        else {
                            $(".price").text(data);
                        }
                    }
                }
            });
            $(".covers").toggle()
            $(".bigWithdrawalBox").toggle()
        })
        $(".cancel-withdrawal").click(function () {
            $(".covers").toggle()
            $(".bigWithdrawalBox").toggle()
        })
        $(".confirm-withdrawal").click(function () {
            $(".confirm-withdrawal").hide();
            $.ajax({
                type: "post",
                data: { TB_TX_PRICE: $("#txprice").val() },
                url: "../../BaseRefWeb.aspx?stype=ISpWithdrawFun&method=DoWebSave&type=sp",
                success: function (result) {
                    var data = JSON.parse(result);
                    if (data.msg == "_timeout") {
                        window.location.href = "../UserLogin/Login.html";
                    }
                    else {
                        $('.phoneError').text(data.msg);
                        var top = ($(window).height() - $('.phoneError').height()) / 2;
                        var left = ($(window).width() - $('.phoneError').width()) / 2;
                        var scrollTop = $(document).scrollTop();
                        var scrollLeft = $(document).scrollLeft();
                        $('.phoneError').css({ position: 'absolute', 'top': top + scrollTop, left: left + scrollLeft }).show();
                        setTimeout(function () {
                            window.location.reload();
                        }, 2000)
                    }
                }
            });
        })
    })
    function clearNoNum(obj) {
        obj.value = obj.value.replace(/[^\d.]/g, "");  //清除“数字”和“.”以外的字符
        obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
        obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');//只能输入两个小数
        if (obj.value.indexOf(".") < 0 && obj.value != "") {//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
            obj.value = parseFloat(obj.value);
        }
    }
</script>